package com.nifostasky.constant;

import com.nifostasky.entity.User;

/**
 * redis key 前缀常量
 */
public class CacheConstant {

    /**
     * 用户cache name
     */
    public static final String USER_CACHE_NAME = "user_cache";

    /**
     * 用户信息缓存key前缀
     */
    public static final String USER_CACHE_KEY_PREFIX = "user_";

    /**
     * 角色cache name
     */
    public static final String ROLE_CACHE_NAME = "role_cache";

    /**
     * 角色信息缓存key前缀
     */
    public static final String ROLE_CACHE_KEY_PREFIX = "role_";

    /**
     * 获取角色cache key
     * @param suffix 后缀
     * @return key
     */
    public static String getRoleCacheKey(String suffix) {
        return ROLE_CACHE_NAME + "::" + ROLE_CACHE_KEY_PREFIX + suffix;
    }

    /**
     * 获取用户cache key
     */
    public static String getUserCacheKey(String suffix) {
        return USER_CACHE_NAME + "::" + USER_CACHE_KEY_PREFIX + suffix;
    }

}
